# FROM node:18-alpine3.14 as build-stage

# WORKDIR /app

# COPY package.json .

# COPY ecosystem.config.js .

# RUN npm config set registry https: // registry.npm.taobao.org/

# RUN npm install -g pnpm

# RUN pnpm install

# COPY . .

# RUN pnpm build

# FROM node:18-alpine3.14 as prod-stage

# COPY --from=build-stage /app/dist /app

# COPY --from=build-stage /app/package.json /app/package.json

# COPY --from=build-stage /app/ecosystem.config.js /app/ecosystem.config.js

# WORKDIR /app

# RUN npm config set registry https: // registry.npm.taobao.org/

# RUN npm install -g pnpm

# RUN npm install -g pm2

# RUN pnpm install --production

# EXPOSE 3000

# CMD ["pm2-runtime","start", "./ecosystem.config.js" ]

FROM node:18-alpine3.14

WORKDIR /app

COPY package.json .

COPY ecosystem.config.js .

RUN npm i -g pm2

RUN npm install -g pnpm

RUN pnpm config set registry http://registry.npm.taobao.org

RUN pnpm install

COPY . .

RUN pnpm build

EXPOSE 9091

CMD ["pm2-runtime","start", "./ecosystem.config.js" ]
